package com.service.atf.base.model;

import com.service.atf.base.core.ByteConvertion;
import com.luotao.devp.base.utils.ByteUtil;

/**
 * User: luotao
 * Date: 12-2-23
 * Time: 15:52:00
 * �����˻�����	�ַ�char(20)	ʡ����+�б���+SEQ	�ֻ�ͻ���
 * ������Ϸ����	int		�ͻ���
 * ��ʱ�н����	Long
 * ������Ϸʱ��	Int
 */
public class TFGameComplate extends BaseHeader implements ByteConvertion {

    private String mapFlowId;

    private int gamecode;

    private long tempAwardMoney;

    private int completeTime;

    public TFGameComplate() {
        setType((byte) '1');
        setTradeType((byte) 'A');
    }

    public int getCompleteTime() {
        return completeTime;
    }

    public void setCompleteTime(int completeTime) {
        this.completeTime = completeTime;
    }

    public int getGamecode() {
        return gamecode;
    }

    public void setGamecode(int gamecode) {
        this.gamecode = gamecode;
    }


    public long getTempAwardMoney() {
        return tempAwardMoney;
    }

    public void setTempAwardMoney(long tempAwardMoney) {
        this.tempAwardMoney = tempAwardMoney;
    }

    public String getFlowId() {
        return flowId;
    }

    public void setFlowId(String flowId) {
        this.flowId = flowId;
    }

    public String getMapFlowId() {
        return mapFlowId;
    }

    public void setMapFlowId(String mapFlowId) {
        this.mapFlowId = mapFlowId;
    }

    @Override
    public ByteConvertion byte2Object(byte[] src) {
        byte2ObjectHeader(src);
        setMapFlowId(ByteUtil.readString(src, LEN_HEAD, 24));
        setGamecode(ByteUtil.readInt(src, LEN_HEAD + 24));
        setTempAwardMoney(ByteUtil.readLong(src, LEN_HEAD + 28));
        setCompleteTime(ByteUtil.readInt(src, LEN_HEAD + 36));
        return null;
    }

    @Override
    public byte[] object2Byte() {
        byte[] head = object2ByteHeader();
        byte[] result = new byte[LEN_HEAD + 40];
        System.arraycopy(head, 0, result, 0, head.length);
        ByteUtil.writeString(result, LEN_HEAD, getMapFlowId(), 24);
        ByteUtil.writeInt(result, LEN_HEAD + 24, getGamecode());
        ByteUtil.writeLong(result, LEN_HEAD + 28, getTempAwardMoney());
        ByteUtil.readInt(result, LEN_HEAD + 36, getCompleteTime());
        return result;
    }
}
